﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Microsoft.Web.Mvc"%>
<asp:Content ID="indexHead" ContentPlaceHolderID="head" runat="server">
    <title>Chi tiết đơn hàng</title>
</asp:Content>
<asp:Content ID="css_js" ContentPlaceHolderID="js_css" runat="server">
    <script type="text/javascript" src="/scripts/historyorder.js"></script>
        <script type="text/javascript" src="/scripts/jquery-1.4.2.min.js"></script>
</asp:Content>
<asp:Content ID="indexContentLeft" ContentPlaceHolderID="left_content" runat="server">
     <div class="title"><span class="title_icon"><img src="/content/images/bullet1.gif" alt="" title="" /></span>Quản lý đơn hàng</div>
        
        	<div class="feat_prod_box_details">
            <!-- Start Detail Bill-->
            <% int i = 0; int j = 0; string type = (string)ViewData["type"];%>
            <% if (type == "Buy")
               { %>
            <% string[][] result = (string[][])ViewData["result"];
               if (result[0] != null && result!=null)
                {%>
                <table class="cart_table">
            	    <tr class="cart_title">
                	    <td>Hình</td>
                	    <td>Tên Sách</td>
                        <td>Giá Bán</td>
                        <td>Số Lượng</td>
                        <td>Tổng Tiền</td> 
                        <td>Ngày Lập</td> 
                        <td>Trạng Thái</td>                          
                    </tr>
                   <% int total = 0;
                      foreach (string[] row in result)
                      {
                          i++;
                          if (row == null) break; total += Convert.ToInt32(row[5]);%>      
            	    <tr>
                	    
                	    <td><a href="/book/detail?id=<%= row[6]%>" title="<div style='width:300px'>
					        <div style='float:left;margin-left:5px;'>
						         <center><img onerror=this.src='/content/images/no_image.jpg' width='98' height='140' src='<%= row[1]%>'></center>
					        </div>
					        <div style='float:left;margin-left:25px'>
					             <div class='tt_name'>
						              <%= Html.Encode(row[2])%>
					             </div>
					             <div class='tt_detail'>
						              <b>Mã Sách : </b><%= row[6]%> <br/><br/>
						              <b>Tác Giả : </b><%= row[8]%> <br/><br/>
						              <b>Giá Bán : </b><%= Html.Encode(row[9])%> VNĐ<br/><br/>
						              <b>Giá Thuê : </b><%= Html.Encode(row[10])%> VNĐ<br/><br/>
						              <b>Ngày Cập Nhật : </b><%= Html.Encode(row[11])%><br/><br/>
					             </div>
					        </div>
					        <div style='clear:both;'></div>	
				            </div>"><img onerror=this.src='/content/images/no_image.jpg' src="<%= row[1]%>" width="23" height="35" alt="" title="" border="0" class="cart_thumb" /></a></td>
				            
                	    <td><%= Html.Encode(row[2])%></td>
                        <td><%= Html.Encode(row[3])%> VNĐ</td>
					    <td><%= Html.Encode(row[4])%></td>
                        <td><%= Html.Encode(row[5])%> VNĐ
                        </td>
                        <td><%= Html.Encode(row[12])%>
                        </td>
                        <td><%= Html.Encode(row[7])%>
                       
                        
                        </td>
                                      
                    </tr>          
            	 <% } %>
            	    <tr>
                    <td colspan="4" class="cart_total"><span class="red">Phí Vận Chuyển:</span></td>
                    <td> <%= Html.Encode(ViewData["total_shipping"])%> VNĐ</td>                
                    </tr> 
				    <tr>
                    <td colspan="4" class="cart_total"><span class="red">Tổng Cộng:</span></td>
                    <td> <%= Html.Encode(total + Convert.ToInt32(ViewData["total_shipping"]))%> VNĐ</td>                
                    </tr>                  
                
                </table>
                     <a class="continue" href="/cart/historyorder">Trở lại</a>  
                   
                <% }
               }
               else
               { %>
                
                <%  string[][] result = (string[][])ViewData["result"];
                if (result != null)
                {%>
                <table class="cart_table">
            	    <tr class="cart_title">
                	   <td>Hình</td>
                	    <td>Tên</td>
                        <td>Giá Thuê</td>
                        <td>Ngày Thuê</td>
					    <td>Số Ngày</td>
                        <td>Ngày Hết Hạn</td>
                        <td>Số Lượng</td>
                        <td>Tổng Tiền</td>  
                        <td>Trạng Thái</td>                 
                    </tr>
                   <% int total_1 = 0;
                      foreach (string[] row in result)
                      {
                          i++;
                          if (row == null) break; total_1 += Convert.ToInt32(row[6]);%>      
            	    <tr>
                	    <td><a href="/book/detail?id=<%= row[6]%>" title="<div style='width:300px'>
					        <div style='float:left;margin-left:5px;'>
						         <center><img onerror=this.src='/content/images/no_image.jpg' width='98' height='140' src='<%= row[1]%>'></center>
					        </div>
					        <div style='float:left;margin-left:25px'>
					             <div class='tt_name'>
						              <%= Html.Encode(row[2])%>
					             </div>
					             <div class='tt_detail'>
						              <b>Mã Sách : </b><%= row[7]%> <br/><br/>
						              <b>Tác Giả : </b><%= row[9]%> <br/><br/>
						              <b>Giá Bán : </b><%= Html.Encode(row[10])%> VNĐ<br/><br/>
						              <b>Giá Thuê : </b><%= Html.Encode(row[11])%> VNĐ<br/><br/>
						              <b>Ngày Cập Nhật : </b><%= Html.Encode(row[12])%><br/><br/>
					             </div>
					        </div>
					        <div style='clear:both;'></div>	
				            </div>"><img onerror=this.src='/content/images/no_image.jpg' src="<%= row[1]%>" width="23" height="35" alt="" title="" border="0" class="cart_thumb" /></a></td>
                	    <td><%= Html.Encode(row[2])%></td>
                        <td><%= Html.Encode(row[3])%> VNĐ</td>
                        <td><%= Html.Encode(row[13])%></td>
                        <td><%= Html.Encode(row[4])%></td>
                        <td><%= Html.Encode(row[14])%></td>
					    <td><%= Html.Encode(row[5])%></td>
                        <td><%= Html.Encode(row[6])%> VNĐ</td>
                        <td><%= Html.Encode(row[8])%> </td>
                           
                    </tr>  
            	 <%} %>
				    <tr>
                    <td colspan="4" class="cart_total"><span class="red">Phí Vận Chuyển:</span></td>
                    <td> <%= Html.Encode(ViewData["total_shipping"])%> VNĐ</td>                
                    </tr> 
                     <tr>
                    <td colspan="4" class="cart_total"><span class="red">Phí Thế Chân:</span></td>
                    <td> <%= Html.Encode(ViewData["deposit"])%> VNĐ</td>                
                    </tr> 
				    <tr>
                    <td colspan="4" class="cart_total"><span class="red">Tổng Cộng:</span></td>
                    <td> <%= Html.Encode(total_1 + Convert.ToInt32(ViewData["total_shipping"]) + Convert.ToInt32(ViewData["deposit"]))%> VNĐ</td>                
                    </tr>                  
                
                </table>
                     <a class="continue" href="/cart/historyorder">Trở lại</a>  
                    
                <% }%>
                
               <%} %>
			<!--- End Detail Bill-->
          
            </div>	

        <div class="clear"></div>

</asp:Content>

<asp:Content ID="indexContentRight" ContentPlaceHolderID="right_content" runat="server">
   <% Html.RenderAction("index","sidebar"); %>
</asp:Content>
